package com.zdkj.subway.support.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zdkj.common.security.util.SecurityUtils;
import com.zdkj.subway.support.dto.out.StationPersonGuardDTO;
import com.zdkj.subway.support.entity.SwPmStationPersonGuard;
import com.zdkj.subway.support.mapper.SwPmStationPersonGuardMapper;
import com.zdkj.subway.support.service.SwPmStationPersonGuardService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 车站人员在岗信息表
 *
 * @author cuilei
 * @date 2020-06-04 10:30:20
 */
@Service
@AllArgsConstructor
public class SwPmStationPersonGuardServiceImpl extends ServiceImpl<SwPmStationPersonGuardMapper, SwPmStationPersonGuard> implements SwPmStationPersonGuardService {
    private final SwPmStationPersonGuardMapper swPmStationPersonGuardMapper;

    @Override
    public IPage<StationPersonGuardDTO> pageSelect(Page page, StationPersonGuardDTO stationPersonGuard) {
        return swPmStationPersonGuardMapper.pageSelect(page, stationPersonGuard, SecurityUtils.getUser().getStationCode());
    }

    @Override
    @Transactional
    public Boolean saveDaiyPersonRecord() {
        swPmStationPersonGuardMapper.truncateDailyRecord();
        return swPmStationPersonGuardMapper.saveDaiyPersonRecord();
    }
}
